package com.lxf.cloudotherserve.controller;

import com.alibaba.fastjson.JSONObject;
import com.lxf.cloudotherserve.annotate.OtherRateLimit;
import com.lxf.cloudotherserve.service.CommentIsLikeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author 罗兴发
 * @data 2025/6/30 14:16
 * @description：评论点赞/踩踏-控制层
 */
@RestController
@CrossOrigin  //跨域
@RequestMapping("/v1")
@Slf4j
public class CommentIsLikeController {
    @Resource
    CommentIsLikeService commentIsLikeService;

    /**
     * 点赞或踩踏评论
     * @param json
     * @param request
     * @return
     */
    @OtherRateLimit(value = 3,timeout = 2)
    @PostMapping("/addCommentIsLike")
    public String addCommentIsLike(@RequestBody JSONObject json, HttpServletRequest request){
        return commentIsLikeService.addCommentIsLike(json,request);
    }
}
